package com.ruoyi.easywenku.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.easywenku.mapper.QuestionTypeMapper;
import com.ruoyi.easywenku.entity.QuestionType;
import com.ruoyi.easywenku.service.IQuestionTypeService;
import com.ruoyi.common.core.text.Convert;

/**
 * 题目分类Service业务层处理
 *
 * @author yx
 * @date 2020-11-17
 */
@Service
public class QuestionTypeServiceImpl implements IQuestionTypeService
{
    @Autowired
    private QuestionTypeMapper questionTypeMapper;

    /**
     * 查询题目分类
     *
     * @param id 题目分类ID
     * @return 题目分类
     */
    @Override
    public QuestionType selectQuestionTypeById(Long id)
    {
        return questionTypeMapper.selectQuestionTypeById(id);
    }

    /**
     * 查询题目分类列表
     *
     * @param questionType 题目分类
     * @return 题目分类
     */
    @Override
    public List<QuestionType> selectQuestionTypeList(QuestionType questionType)
    {
        return questionTypeMapper.selectQuestionTypeList(questionType);
    }

    /**
     * 新增题目分类
     *
     * @param questionType 题目分类
     * @return 结果
     */
    @Override
    public int insertQuestionType(QuestionType questionType)
    {
        questionType.setCreateTime(DateUtils.getNowDate());
        return questionTypeMapper.insertQuestionType(questionType);
    }

    /**
     * 修改题目分类
     *
     * @param questionType 题目分类
     * @return 结果
     */
    @Override
    public int updateQuestionType(QuestionType questionType)
    {
        return questionTypeMapper.updateQuestionType(questionType);
    }

    /**
     * 删除题目分类对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteQuestionTypeByIds(String ids)
    {
        return questionTypeMapper.deleteQuestionTypeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除题目分类信息
     *
     * @param id 题目分类ID
     * @return 结果
     */
    @Override
    public int deleteQuestionTypeById(Long id)
    {
        return questionTypeMapper.deleteQuestionTypeById(id);
    }
}
